/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package mathma.core.vector;

import mathma.core.expr.Expression;

import mathma.core.form.UnaryExpression;

import mathma.core.value.Value;

/**
 * @since 0.2.6
 * @author Ethan Levine
 */
public class VectorMagnitudeExpression<E extends Value>
        extends UnaryExpression<E, Vector<E>> {

    public VectorMagnitudeExpression(Expression<Vector<E>> operand) {
        // TODO - fix valuetype argument
        super(Vector.GenericType, operand);
    }

    public E evaluate() {
        return getOperand().evaluate().magnitude();
    }

    public VectorMagnitudeExpression<E> newUnaryExpression(
            Expression<Vector<E>> operand) {
        return new VectorMagnitudeExpression<E>(operand);
    }
}
